'''
@Author: your name
@Date: 2019-06-24 11:32:40
LastEditTime: 2021-11-13 10:15:14
LastEditors: Please set LastEditors
@Description: In User Settings Edit
@FilePath: /tinyms/tinyms-api/apps/cms/link/views.py
'''
from flask import render_template,request,jsonify
from . import cms_articlechannel
from .service import ChannelArticleService
from .model import ChannelArticle
from apps.utils import auty
from apps.utils.TypeUtils import TypeUtils

import json
import uuid
import time


'''
通过文章查询所在栏目
'''
@cms_articlechannel.route('/list',methods=['GET','POST'])
@auty.login_required
def list():
    if request.method == "POST":
        fk_article_pk = request.form.get("article_pk")
    else:
        fk_article_pk = request.args.get("article_pk")
    channelArticle = ChannelArticle()
    channelArticle.fk_article_pk=fk_article_pk
    channelArticles = ChannelArticleService.list(channelArticle)
    data = {
        'msg':'success',
        'code':0,
        'data':[TypeUtils.list_to_dict(channelArticle) for channelArticle in channelArticles]
    }
    return json.dumps(data)







